<?php

class Login extends Controller
{
	var $data=array();
	
	public function __construct()
	{
		parent::Controller();	
		$this->data['name']='';
		$this->data['email']='';
		$this->data['street_address']='';
		$this->data['city']='';
		$this->data['country']='';
		$this->data['warning']='';
	}
	
	function index()
	{
		$this->load->helper('email');
		
		if($this->input->post('submit'))
		{
			$this->data['name']=trim($this->input->post('customer_name'));
			$this->data['email']=trim($this->input->post('customer_email'));
			$this->data['street_address']=trim($this->input->post('customer_st_address'));
			$this->data['city']=trim($this->input->post('customer_city'));
			$this->data['country']=trim($this->input->post('customer_country'));

			if($this->input->post('submit'))
			{
				if(strcmp($this->data['name'], '')==0)
				{
					$this->data['warning']="Please enter your name. <br />\n";
				}
				else if(!valid_email($this->data['email']))
				{
					$this->data['warning']="Please enter a valid email. <br />\n";
				}
				else if(strcmp($this->data['street_address'], '')==0)
				{
					$this->data['warning']="Please enter your street adress. <br />\n";
				}
				else if(strcmp($this->data['city'], '')==0)
				{
					$this->data['warning']="Please enter your city. <br />\n";
				}
				else if(strcmp($this->data['country'], '')==0)
				{
					$this->data['warning']="Please enter your country. <br />\n";
				}
				
				else 
					echo "Being Processed!";

			}
			
		}
		
		// pases the information of the data to the view
		$this->load->view("login",$this->data);
	}

	function view_item_page()
	{
	}

}
?>